﻿@{
    Layout = null;
}
@model ElingOA6_Admin_DSJCJ.Model.Fwmmszbt
<!DOCTYPE html>
<html>
<head>
<base target="_self" />
@Html.Partial("LoadPanelPartial")
   @if (false)
   {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
   }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/regex.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>

    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)


    <script type="text/javascript">


        $(document).ready(function () {
            var hdjsAlert = $("#hidMessage").val();
            var hdjsAlert2 = $("#hidIsClose").val();
            if (hdjsAlert != "") {
                alert(hdjsAlert);
                if (hdjsAlert2 == "Y") {
                    window.returnValue = 'SUCCESS';
                    window.close();
                }
            }
        });

        $(function () {
            if ($("#hidsfz").val() == "1") {
                ASPxClientTextBox.Cast("tbsfz").SetEnabled(false);
            } else {
                ASPxClientTextBox.Cast("tbsfz").SetEnabled(true);
            }



            $('input[name=tbyjsk]').keydown(function () {
                var k = window.event.keyCode;

                if ((k == 161) || (k == 46) || (k == 8) || (k == 190) || (k == 110) || (k >= 48 && k <= 57) || (k >= 96 && k <= 105) || (k >= 37 && k <= 40)) {
                    if (k == 110 || k == 190) {

                        if ($(this).val().length == 0 || $(this).val().indexOf(".") != -1) {

                            window.event.returnValue = false;
                        }
                    }
                    if (k == 161) {
                        window.event.keyCode = 64;
                    }
                }
                else if (k == 13) {
                    window.event.keyCode = 9;
                }
                else {
                    window.event.returnValue = false;
                }
            });


            $('input[name=tbbtbl]').keydown(function () {
                var k = window.event.keyCode;

                if ((k == 161) || (k == 46) || (k == 8) || (k == 190) || (k == 110) || (k >= 48 && k <= 57) || (k >= 96 && k <= 105) || (k >= 37 && k <= 40)) {
                    if (k == 110 || k == 190) {

                        if ($(this).val().length == 0 || $(this).val().indexOf(".") != -1) {

                            window.event.returnValue = false;
                        }
                    }
                    if (k == 161) {
                        window.event.keyCode = 64;
                    }
                }
                else if (k == 13) {
                    window.event.keyCode = 9;
                }
                else {
                    window.event.returnValue = false;
                }
            });

            $('input[name=tbybtse]').keydown(function () {
                var k = window.event.keyCode;

                if ((k == 161) || (k == 46) || (k == 8) || (k == 190) || (k == 110) || (k >= 48 && k <= 57) || (k >= 96 && k <= 105) || (k >= 37 && k <= 40)) {
                    if (k == 110 || k == 190) {

                        if ($(this).val().length == 0 || $(this).val().indexOf(".") != -1) {

                            window.event.returnValue = false;
                        }
                    }
                    if (k == 161) {
                        window.event.keyCode = 64;
                    }
                }
                else if (k == 13) {
                    window.event.keyCode = 9;
                }
                else {
                    window.event.returnValue = false;
                }
            });


        });

        function valueChange(s, e) {
            if (tbyjsk.GetText() != "" && tbbtbl.GetText != "") {
                var ybtse = Math.round(tbyjsk.GetText() * tbbtbl.GetText()) / 100;
                ASPxClientTextBox.Cast("tbybtse").SetText(ybtse);
            }

        }

        /*取消*/
        function cancel() {
            window.close();

        }


        function ok() {
            if (tbsfz.GetText().length != 18 && tbsfz.GetText().length != 15) {
                alert('身份证长度不正确，请检查。');
                return false;
            }

            if (tbbtrq.GetText() == "") {
                alert('日期不能为空');
                return false;
            }
            if (tbnsr.GetText() == "") {
                alert('纳税人没有录入，请检查。');
                return false;
            }

            if (tbbtbl.GetText() == "" || tbbtbl.GetText() < 0 || tbbtbl.GetText() > 100) {
                alert('补贴比例应少于等于100，请检查。');
                return false;
            }
            if (tbkhyh.GetText() == "") {
                alert('银行不能为空');
                return false;
            }

            if (tbybtse.GetText() != Math.round(tbyjsk.GetText() * tbbtbl.GetText()) / 100) {
                alert('房价总额＊补贴比例＝应补贴金额，公式不成立，请检查。');
                return false;
            }
            if (tbybtse.GetText() == "") {
                alert('应补贴金额应录入数值格式，请检查。');
                return false;
            }

            if (tbyjsk.GetText() == "" || isNaN(tbyjsk.GetText()) == true) {
                alert('房价总额应录入数值格式，请检查。');
                return false;
            }
            if (tbzh.GetText() == "") {
                alert('帐号没有录入，请检查。');
                return false;
            }

            form1.submit();
        }
        
    </script>
</head>
<body>
@using (Html.BeginForm("SaveFwmmszbt", "Fwmmszbt", FormMethod.Post, new { id = "form1", @class = "tableForm" }))
{
        <table class="tableForm" align = "center" width="100%">
        <tr>
        <td align="center" colspan="4">
           <h2>个人普通房屋买卖财政补贴</h2>
        </td></tr>
        <tr>
        <td align="left" colspan="4">
        @Html.DevExpress().Label(settings => { 
            settings.Text = "鄞州区财政局"; 
   
         }).GetHtml()</td></tr>
        <tr>
        <th>日期:</th>
        <td class="tdClass" colspan="3">
                   @Html.DevExpress().DateEdit(settings =>
              {
                  settings.Name = "tbbtrq";
                  settings.Properties.NullText = "";
                  settings.Properties.DisplayFormatString = "yyyy-MM-dd";
                  settings.Properties.EditFormatString = "yyyy-MM-dd";
                  settings.Date = Model.btrq;

              }).GetHtml()
        </td>       
        </tr>
        
        <tr>
        <th>身份证:</th>
        <td width="300">
            @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbsfz";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.sfz;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
               @Html.Hidden("hidsfz", ViewData["sfz"])                    
               </td>                   

        <th>纳税人:</th>
        <td width="200">
        @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbnsr";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.nsr;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
               </td>
        
        </tr>

        <tr>
            <th>已缴税款:</th>
            <td>
            @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbyjsk";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.yjsk.ToString();
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
                   settings.Properties.ClientSideEvents.TextChanged = "function(s, e){ valueChange(s ,e)}";
               }).GetHtml()                                        
               </td>
               <td>@Html.DevExpress().Label(settings => { settings.Text = "元"; }).GetHtml()</td>
               </tr>
             <tr>  
               <th>补贴额度:</th>
            <td>
            @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbbtbl";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.btbl.ToString();
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
                   settings.Properties.ClientSideEvents.TextChanged = "function(s, e){ valueChange(s ,e)}";
               }).GetHtml()                          
               </td>
               <td>@Html.DevExpress().Label(settings => { settings.Text = "%"; }).GetHtml()</td>  
         </tr>
         <tr>
            <th>应补贴税额:</th>
            <td>
            @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbybtse";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.ybtse.ToString();
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
                   settings.Properties.ClientSideEvents.TextChanged = "function(s, e){ valueChange(s ,e)}";
               }).GetHtml() 
                                       
               </td>
               <td>@Html.DevExpress().Label(settings => { settings.Text = "元"; }).GetHtml()</td>             
         </tr>
        <tr>
         <th>税种:</th>
                <td>
                     @Html.DevExpress().RadioButtonList(settings =>
                {
                    settings.Name = "tbsz";
                    settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Table;
                    settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                    settings.Properties.RepeatColumns = 2;
                }).BindList(new List<SelectListItem> { 
                            new SelectListItem { Text = "个人所得税", Value = "个人所得税"}, 
                            new SelectListItem { Text = "契税", Value = "契税" } 
                        }).Bind(Model.sz).GetHtml()
                </td>
        </tr>
        <tr>
        <th>开户银行:</th>
        <td class="tdClass">
            @Html.DevExpress().ComboBox(settings =>
               {
                   settings.Name = "tbkhyh";
                   settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                   settings.Properties.TextField = "Text";
                   settings.Properties.ValueField = "Value";
               }).BindList(new List<SelectListItem> 
                        { 
                            new SelectListItem { Text = "鄞州银行", Value = "鄞州银行" }, 
                            new SelectListItem { Text = "农行", Value = "农行" }
               }).Bind(Model.khyh).GetHtml()
               </td>
               <th>帐号:</th>
        <td>
             @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "tbzh";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
                   settings.Text = Model.zh;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
               </td>
                      
        </tr>
            <tr>
             <th></th>                        
            <td>
                @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnOK";
                settings.Text = "确定";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/ok.png");
                settings.ClientSideEvents.Click = "ok";
            }).GetHtml()
                @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnCancel";
                settings.Text = "取消";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/no.png");
                settings.CausesValidation = false;
                settings.ClientSideEvents.Click = "cancel";

            }).GetHtml()
            </td>
        </tr>
        </table>
        @Html.Hidden("hidMessage", ViewData["message"])
         @Html.Hidden("hidIsClose", ViewData["IsClose"])
         @Html.Hidden("hidid", ViewData["id"])

        @Html.Hidden("hdtype", ViewData["type"])
}    

</body>
</html>
